package java_0500_collection;

@SuppressWarnings({"all"})
public class HashSetStructure {
    public static void main(String[] args) {
        //1.创建一个数组，数组的类型是Node[],也称为表
        Node[] table = new Node[16];

        //2.创建节点
        Node john = new Node("john", null);
        table[2] = john;

        Node jack = new Node("jack", null);
        john.next = jack;//将jack挂载到john上

        Node rose = new Node("rose", null);
        jack.next = rose;//将rose挂载到jack上

        Node lucy = new Node("lucy", null);
        table[3] = lucy;
        System.out.println("table=" + table);

    }
}

class Node {//节点，存储数据，可以指向下一个节点，从而形成链表
    Object item;//存储数据
    Node next;//指向下一节点

    public Node(Object item, Node next) {
        this.item = item;
        this.next = next;
    }
}